/*     */ package com.lmpop.createIndex.search;
/*     */ 
/*     */ import com.lmpop.createIndex.searchModel.Queue;
/*     */ import com.lmpop.createIndex.searchModel.QueueValue;
/*     */ import com.lmpop.createIndex.searchModel.SearchData;
/*     */ import com.lmpop.createIndex.searchModel.SearchModel;
/*     */ import java.io.IOException;
/*     */ import java.util.ArrayList;
/*     */ import java.util.List;
/*     */ import java.util.Map;
/*     */ 
/*     */ public class B2CTeamBuyWuIndexFiles
/*     */ {
/*     */   public ProperUtil properUtil;
/*     */   private String file_path;
/*     */ 
/*     */   public B2CTeamBuyWuIndexFiles()
/*     */   {
/*  20 */     this.properUtil = new ProperUtil();
/*  21 */     this.file_path = this.properUtil.getFilePathByModel("b2cteambuywu");
/*     */   }
/*     */ 
/*     */   public List getTeamBuyList(Map paraMap) throws IOException
/*     */   {
/*  26 */     ArrayList teambuyList = new ArrayList();
/*  27 */     SearchData search = new SearchData();
/*  28 */     ArrayList paraList = new ArrayList();
/*     */ 
/*  30 */     String type = ""; String team_type = ""; String title = ""; String cat_attr = ""; String start_date = ""; String in_date = ""; String end_date = ""; String limit_num = ""; String team_num = ""; String down_num = ""; String seller = "";
/*  31 */     if (paraMap.get("type") != null) type = paraMap.get("type").toString();
/*  32 */     if (paraMap.get("team_type") != null) team_type = paraMap.get("team_type").toString();
/*  33 */     if (paraMap.get("start_date") != null) start_date = paraMap.get("start_date").toString();
/*  34 */     if (paraMap.get("end_date") != null) end_date = paraMap.get("end_date").toString();
/*  35 */     if (paraMap.get("limit_num") != null) limit_num = paraMap.get("limit_num").toString();
/*  36 */     if (paraMap.get("team_num") != null) team_num = paraMap.get("team_num").toString();
/*  37 */     if (paraMap.get("down_num") != null) down_num = paraMap.get("down_num").toString();
/*     */ 
/*  39 */     if (paraMap.get("cat_attr") != null) cat_attr = paraMap.get("cat_attr").toString();
/*  40 */     if (paraMap.get("title") != null) title = paraMap.get("title").toString();
/*  41 */     paraList.add(new SearchModel("0", "type", type));
/*  42 */     paraList.add(new SearchModel("0", "team_type", team_type));
/*  43 */     paraList.add(new SearchModel("0", "start_date", start_date));
/*  44 */     paraList.add(new SearchModel("0", "end_date", end_date));
/*  45 */     paraList.add(new SearchModel("0", "limit_num", limit_num));
/*  46 */     paraList.add(new SearchModel("0", "team_num", team_num));
/*  47 */     paraList.add(new SearchModel("0", "down_num", down_num));
/*  48 */     if (!cat_attr.equals(""))
/*  49 */       paraList.add(new SearchModel("0", "cat_attr", cat_attr));
/*  50 */     if (!title.equals(""))
/*  51 */       paraList.add(new SearchModel("0", "title", title));
/*  52 */     Queue queue = new Queue(new QueueValue[] { new QueueValue("in_date", 2, true) });
/*  53 */     teambuyList = search.getSearchInfo(this.file_path, paraList, queue);
/*  54 */     return teambuyList;
/*     */   }
/*     */ 
/*     */   public Map getOneTeambuy(String goods_id) throws IOException {
/*  58 */     SearchData search = new SearchData();
/*  59 */     ArrayList paraList = new ArrayList();
/*  60 */     paraList.add(new SearchModel("0", "info_id", goods_id));
/*  61 */     return search.getSearchObject(this.file_path, paraList);
/*     */   }
/*     */ 
/*     */   public List getTeambuyInfo(Map paraMap) throws IOException {
/*  65 */     ArrayList showList = new ArrayList();
/*  66 */     SearchData search = new SearchData();
/*  67 */     ArrayList paraList = new ArrayList();
/*  68 */     String type = ""; String team_type = ""; String title = ""; String cat_attr = ""; String area_attr = ""; String start_date = ""; String in_date = ""; String end_date = ""; String limit_num = ""; String team_num = ""; String down_num = ""; String seller = "";
/*  69 */     String start_price = ""; String end_price = ""; String up_price = ""; String down_price = ""; String sort_type = "in_date"; String sort = "desc";
/*  70 */     boolean orderby = false;
/*  71 */     if (paraMap.get("type") != null) type = paraMap.get("type").toString();
/*  72 */     if (paraMap.get("team_type") != null) team_type = paraMap.get("team_type").toString();
/*  73 */     if (paraMap.get("start_date") != null) start_date = paraMap.get("start_date").toString();
/*  74 */     if (paraMap.get("end_date") != null) end_date = paraMap.get("end_date").toString();
/*  75 */     if (paraMap.get("limit_num") != null) limit_num = paraMap.get("limit_num").toString();
/*  76 */     if (paraMap.get("team_num") != null) team_num = paraMap.get("team_num").toString();
/*  77 */     if (paraMap.get("down_num") != null) down_num = paraMap.get("down_num").toString();
/*  78 */     if (paraMap.get("cat_attr") != null) cat_attr = paraMap.get("cat_attr").toString();
/*  79 */     if (paraMap.get("area_attr") != null) area_attr = paraMap.get("area_attr").toString();
/*  80 */     if (paraMap.get("title") != null) title = paraMap.get("title").toString();
/*  81 */     if (paraMap.get("start_price") != null) start_price = paraMap.get("start_price").toString();
/*  82 */     if (paraMap.get("end_price") != null) end_price = paraMap.get("end_price").toString();
/*  83 */     if (paraMap.get("up_price") != null) up_price = paraMap.get("up_price").toString();
/*  84 */     if (paraMap.get("down_price") != null) down_price = paraMap.get("down_price").toString();
/*  85 */     if (paraMap.get("sort_type") != null) sort_type = paraMap.get("sort_type").toString();
/*  86 */     if (paraMap.get("sort") != null) {
/*  87 */       sort = paraMap.get("sort").toString();
/*  88 */       if (sort.equals("asc"))
/*  89 */         orderby = true;
/*     */     }
/*  91 */     paraList.add(new SearchModel("0", "type", type));
/*  92 */     paraList.add(new SearchModel("0", "team_type", team_type));
/*  93 */     paraList.add(new SearchModel("0", "start_date", start_date));
/*  94 */     paraList.add(new SearchModel("0", "end_date", end_date));
/*  95 */     paraList.add(new SearchModel("0", "limit_num", limit_num));
/*  96 */     paraList.add(new SearchModel("0", "team_num", team_num));
/*  97 */     paraList.add(new SearchModel("0", "down_num", down_num));
/*  98 */     if (!cat_attr.equals(""))
/*  99 */       paraList.add(new SearchModel("0", "cat_attr", cat_attr));
/* 100 */     if (!area_attr.equals(""))
/* 101 */       paraList.add(new SearchModel("0", "area_attr", area_attr));
/* 102 */     if (!title.equals(""))
/* 103 */       paraList.add(new SearchModel("0", "title", title));
/* 104 */     Queue queue = new Queue(new QueueValue[] { new QueueValue(sort_type, 2, orderby) });
/*     */ 
/* 106 */     if ((!start_price.equals("")) && (!end_price.equals(""))) {
/* 107 */       start_price = addZeroByLeft(start_price);
/* 108 */       end_price = addZeroByLeft(end_price);
/* 109 */       paraList.add(new SearchModel("3", "_price", start_price, end_price));
/*     */     }
/* 111 */     if (!up_price.equals("")) {
/* 112 */       start_price = addZeroByLeft(up_price);
/* 113 */       end_price = addZeroByLeft("9999999999");
/* 114 */       paraList.add(new SearchModel("3", "_price", start_price, end_price));
/*     */     }
/* 116 */     if (!down_price.equals("")) {
/* 117 */       start_price = addZeroByLeft("0");
/* 118 */       end_price = addZeroByLeft(down_price);
/* 119 */       paraList.add(new SearchModel("3", "_price", start_price, end_price));
/*     */     }
/* 121 */     showList = search.getSearchInfo(this.file_path, paraList, queue);
/* 122 */     return showList;
/*     */   }
/*     */ 
/*     */   public String addZeroByLeft(String price) {
/* 126 */     if (price.equals("")) return "";
/* 127 */     int price_len = price.length();
/* 128 */     int add_len = 0;
/* 129 */     if (price_len < 10) {
/* 130 */       add_len = 10 - price_len;
/*     */     }
/* 132 */     String zeroStr = "";
/* 133 */     for (int i = 0; i < add_len; i++) {
/* 134 */       zeroStr = zeroStr + "0";
/*     */     }
/* 136 */     return zeroStr + price;
/*     */   }
/*     */ }

/* Location:           F:\电商\commons-utils.jar
 * Qualified Name:     com.lmpop.createIndex.search.B2CTeamBuyWuIndexFiles
 * JD-Core Version:    0.6.0
 */